//  Gmof - A meta-object facility library based on OMG's EMOF 
//
//  Copyright (C) 2007 Peter Hagg <peter.hagg@iki.fi>
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//
#include "Package.h"
#include "ReflectiveCollection.h"

Gmof::Package::Package(const Glib::ustring& name, const Glib::ustring& uri, Package* parent) : Glib::ObjectBase("Package"), Gmof::NamedElement(name)
{
	this->uri = uri;
	this->owned_type = new ReflectiveCollection();
	this->nested_package = new ReflectiveCollection();
	this->nesting_package = NULL;
	
	if (parent != NULL)
	{
		parent->nested_package->add(this);
		parent->reference();
		nesting_package = parent;
		reference();
	}
}

Gmof::Package::~Package()
{
	owned_type->unreference();
	nested_package->unreference();
	
	if (nesting_package != NULL)
	{
		nesting_package->unreference();
	}
}

Gmof::Element*
Gmof::Package::container()
{
	return nesting_package;
}

// End of file
